package jdbc;

import org.apache.commons.beanutils.BeanUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author liuziyang
 * @create 2018-07-30 21:27
 */
public class BeanUtilsTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(BeanUtilsTest.class);

    @Test
    public void testSetProperty() throws InvocationTargetException, IllegalAccessException {
        Object object = new Customer();
        LOGGER.debug(object.toString());

        BeanUtils.setProperty(object, "name", "test");
        LOGGER.debug(object.toString());
    }

    @Test
    public void testGetProperty() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Object object = new Customer();
        LOGGER.debug(object.toString());

        BeanUtils.setProperty(object, "name", "test");
        LOGGER.debug(object.toString());

        Object val = BeanUtils.getProperty(object, "name");
        LOGGER.debug(val.toString());
    }
}
